package API.DateDome.LocalDateTimeDome;

import java.time.LocalTime;

/**
 * ClassName:LocalDateTimeText004
 * Package:API.DateDome.LocalDateTimeDome
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/2/2-19:00
 * @Version:v1.0
 */
public class LocalTimeDome {
    /*LocalTime：时分秒*/
    public static void main(String[] args) {
        //获取本地时间的日历对象
        LocalTime nowTime = LocalTime.now();
        System.out.println("今天的时间："+nowTime);

        int hour = nowTime.getHour();
        System.out.println("hour:"+hour);

        int minute = nowTime.getMinute();
        System.out.println("minute:"+minute);

        int second = nowTime.getSecond();
        System.out.println("second:"+second);

        //获取纳秒
        int nano = nowTime.getNano();
        System.out.println("nano:"+nano);

        System.out.println("==========================");
        System.out.println(LocalTime.of(8,20));
        System.out.println(LocalTime.of(8,20,35));
        System.out.println(LocalTime.of(8,20,35,5151));
        LocalTime mTime = LocalTime.of(8,20,50,100);

        //is系列的方法
        System.out.println(nowTime.isBefore(mTime));
        System.out.println(nowTime.isAfter(mTime));

        //with系列的方法
        System.out.println(nowTime);
        System.out.println(nowTime.withHour(13));

        //plus系列方法
        System.out.println(nowTime.plusHours(1));


    }
}
